package com.tedu.api;


import org.junit.Test;

import java.util.Locale;

public class 作业 {
    @Test
    public void testLength(){
        String s="HelloJava";
        System.out.println(s.length());
    }
    @Test
    public void testIndexOf(){
        String s="HelloJava";
        int index=s.indexOf("o");
        System.out.println("o出现的位置"+index);
    }
    @Test
    public void testLastIndexOf(){
        String str="HelloJava";
        int index=str.indexOf("o");
        System.out.println("标位5第一次出现o的位置："+index);
        index=str.lastIndexOf("o",5);
        System.out.println("o"+index);
    }
    @Test
    public void testSubString(){
        String url="HelloJava";
        String s=url.substring(0,5);
        System.out.println("截取后的字符串："+s);
    }
    @Test
    public void testSubString1(){
        String url1="HelloJava";
        String s1=url1.substring(5,9);
        System.out.println("截取后的字符串："+s1);
    }
    @Test
    public void testTrim(){
        String str="Hello";
        str=str.trim();
        System.out.println(str);
    }
    @Test
    public void testCharAt(){
        String str="HelloJava";
        char c=str.charAt(5);
        System.out.println(c);
    }
    @Test
    public void testUL(){
        String str="HelloJava";
        str=str.toLowerCase().trim();
        System.out.println("转换为小写："+str);
        str=str.toUpperCase().trim();
        System.out.println("转换为大写："+str);
    }

}
